const mongoose = require('mongoose')

mongoose.connect('mongodb://localhost:27017/test',)

const Schema = mongoose.Schema 

const BooksSchema = new Schema({
  name:{
    type: 'string',
    required: true
  },
  author:{
    type: 'string',
    required: true
  },
  fenlei:{
    type: 'string',
    required: true
  },
  desc:{
    type: 'string'
  },
})


module.exports = mongoose.model('Books',BooksSchema );

/* book.save((err,ret) => {
  if(err){
    console.log(err);
  }
  console.log('保存成功');
  console.log(ret);
}) */

/* Books.remove((err,ret) => {
  if(err){
    console.log(err);
  }
  console.log('查找成功');
  console.log(ret);
}) */

